#ifndef GS_MANAGED_H
#define GS_MANAGED_H

namespace Gs
{
	// Represents a managed (garbage collected) object.
	class Managed
	{
	public:
		// Initialises a new instance of the Managed class.
		Managed();

		// Destroys the instance.
		virtual ~Managed();

	private:
		// Specifies the state of the managed object.
		enum State
		{
			// The managed object is unreferenced and can be freed.
			Unreferenced,

			// The managed object has yet to have it's reference status determined.
			Indeterminate,

			// The managed object is referenced and cannot be freed.
			Referenced
		};

		// Allows the garbage collector to gain access to the managed object's state.
		friend class GarbageCollector;

		// Stores the state of the managed object.
		State _state;

		// Stores a pointer to the next managed object.
		Managed *_next;
	};
}

#endif